package cloudoer.su.dao.impl;

import cloudoer.su.base.impl.BaseDaoImpl;
import cloudoer.su.dao.RoleDao;
import cloudoer.su.entity.Role;
import cloudoer.su.entity.User;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("roleDao")
public class RoleDaoImpl extends BaseDaoImpl<Role> implements RoleDao<Role> {
    public List<User> getUsers (String id, int pageNo, int pageSize){
        return getSession().createQuery("from User t where t.roleId = :id")
                .setString("id",id)
                .setFirstResult((pageNo - 1) * pageSize)
                .setMaxResults(pageSize)
                .list();
    }

}
